package cn.bopomo.dealer.base.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import cn.bopomo.dealer.base.common.ServiceConfig;
import cn.bopomo.dealer.base.service.IOperatorService;
import cn.bopomo.dealer.base.util.ResultCode;
import cn.bopomo.dealer.base.vo.OperatorDetail;
import cn.bopomo.dealer.base.vo.OperatorForm;

public class DeleteOperatorAction extends BaseAction {

	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		// TODO Auto-generated method stub
		
		String operatorId = request.getParameter("oid");
		
		if (operatorId == null || "".equals(operatorId.trim())){
			//报错
		}
		
		IOperatorService os = (IOperatorService)this.findService(ServiceConfig.OPERATOR_SERVICE);
		OperatorDetail operator = os.getOperatorDetail(operatorId);
		if (operator == null){
			//报错
		}
		
		operator.setIsDelete("1");
		
		
		String result = os.modifyOperator(operator);
		
		if (!ResultCode.OP_SUCCESS.equals(result)){
			//报错
		}
		
		return this.findSuccess(mapping);
	}
	
}
